/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2024.
 * Description: Support dumping ftrace logs to non-volatile memory.
 * Author: Chen Zechuan
 * Create: 2023/9/13
 */

#include <linux/ioport.h>
#include <linux/atomic.h>
#include <linux/signal.h>
#include <trace/events/signal.h>
#include <linux/kbox/kbox.h>
#include <linux/rtos_sec.h>

#ifdef CONFIG_X86_64
#include <asm/e820/api.h>
#endif

#define KERNEL_SCHED_SWITCH_ENABLE 1
#define KERNEL_SCHED_SWITCH_DISABLE 0

static int board_cpu_num;
static atomic_t ttrace_disable_cnt = ATOMIC_INIT(0);

phys_addr_t __read_mostly raw_dump_addr;
unsigned long __read_mostly raw_dump_size;

unsigned long raw_dump_vaddr;
void *swap_page_fiq;

static DEFINE_SEMAPHORE(dump_mem_mutex);